package com.ylbh.modules.usercoupon.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylbh.common.pojo.usercoupon.dto.UserCouponDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.utils.PageUtils;

import com.ylbh.modules.usercoupon.mapper.ShoppingUserCouponMapper;
import com.ylbh.modules.usercoupon.entity.ShoppingUserCoupon;
import com.ylbh.modules.usercoupon.service.ShoppingUserCouponService;

import java.util.List;


@Service("shoppingUserCouponService")
public class ShoppingUserCouponServiceImpl extends ServiceImpl<ShoppingUserCouponMapper, ShoppingUserCoupon> implements ShoppingUserCouponService {

    @Autowired
    private ShoppingUserCouponMapper shoppingUserCouponMapper;

    /**
     * 优惠券领取记录
     * @param dto
     * @return
     */
    @Override
    public PageUtils queryUserCouponRecordList(UserCouponDTO dto) {
        Page<Object> page = new Page<>(dto.getPage(), dto.getLimit());
        List<ShoppingUserCoupon> list = shoppingUserCouponMapper.selectUserCouponRecordList(dto, page);
        return new PageUtils(new Page<ShoppingUserCoupon>().setTotal(page.getTotal()).setRecords(list));
    }
}
